package com.sam.cloud.center.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @classname: IndexController
 * @description: TODO
 * @Author: sam
 * @date: 2021/8/9 14:05
 */
@RefreshScope
@RestController
public class IndexController {

    @Value("${server.port}")
    private String port;

    @Value("${spring.application.name}")
    private String appName;

    @Value("${config.info}")
    private String configInfo;

    @GetMapping("info")
    public String info(){

        StringBuffer sb = new StringBuffer();
        sb.append("appName:").append(appName);
        sb.append("\r\n");
        sb.append("port:").append(port);
        sb.append("\r\n");
        sb.append("configInfo:").append(configInfo);
        return sb.toString();
    }
}
